home *** CD-ROM | disk | FTP | other *** search
/ Risc World 3 / Risc World 3.iso / SOFTWARE / ISSUE3 / POWERBASE / DOCS / Ch02-Edit < prev    next >
Text File  |  2001-01-25  |  40KB  |  743 lines

  1. ===========================
  2. Ch 2 − Browsing and Editing
  3. ===========================
  4.  
  5. When you open a database you will normally see two windows. The record
  6. window displays one data record at a time. Each item of data in the record
  7. occupies a rectangle called a field. The keypad contains buttons for moving
  8. around the database, adding and deleting records, searching for records etc.
  9. It may be toggled between full size and a display of the first two rows of
  10. buttons only. You can also suppress the keypad and put some or all of its
  11. buttons on the record window itself (see 4.2.11).  The sample database Boxes
  12. illustrates this.  In this chapter we will assume that you are using the
  13. keypad.
  14.  
  15. Both windows may be moved to whatever position on the screen you find most
  16. convenient and the record window may be re-sized.  When you close the
  17. database the position of the keypad and the position and size of the record
  18. window are stored so that they will look the same next time you open the
  19. database.
  20.  
  21. Most of the keypad functions have keystroke equivalents provided by the
  22. numbered function keys (F1−F11) and experienced users might want to use
  23. these instead of the mouse. The relevant keystrokes are given in the text
  24. where appropriate but note that these are default values and may be
  25. redefined if so desired. Many other actions have equivalent Ctrl sequences
  26. which can’t be redefined.  See Appendix B for a complete list.
  27.  
  28. 2.1     Subfiles, record numbers and keys
  29. -----------------------------------------
  30. Look at the title-bar of the record window. Three pieces of information are
  31. displayed; the subfile number, the record number and the key of the record. 
  32. Since we will make frequent reference to these three terms it will be as
  33. well to explain at the outset what each one means.
  34.  
  35. 2.1.1   Subfiles
  36.  
  37. Suppose you have a bookshelf, capable of holding 100 books, and six
  38. partitions, numbered 0−5, which you can use to divide it into sections.  The
  39. partitions are, to begin with, all stacked together at the left-hand end of
  40. the shelf.  You may leave them like this if you wish and fill up the shelf
  41. with an unbroken run of 100 books. If, however, the books fall into well
  42. defined categories you might prefer to use the partitions to divide the
  43. shelf up into sections. There are no restrictions on where you can place the
  44. partitions, or how many books can fall into each section of shelf, so long
  45. as you don’t exceed a total of 100 books.
  46.  
  47. In a similar way every Powerbase database is able to use up to six subfiles
  48. numbered 0-5. When you open the database you are looking at subfile 0 and
  49. you might have no occasion to bother with the others at all, in which case
  50. they can be ignored. Like the bookshelf partitions subfiles are there for
  51. you to use or not use depending on what your requirements are.  The database
  52. remains the same size whether you use one subfile or all six and the number
  53. of records in a subfile is limited only by the defined size of the database.
  54.  
  55. Section 2.2.4 suggests instances in which you might find it advantageous to
  56. use more than one subfile.
  57.  
  58. 2.1.2   Record numbers
  59.  
  60. Every record in the database has a number which specifies its position in a
  61. file called Database. As you step through the records (see 2.2) you will
  62. probably find that the record numbers shown in the title-bar look quite
  63. random.  Record numbers reflect the order in which records were originally
  64. entered into the database, not the order in which you see them while
  65. browsing. The latter is determined by the key.
  66.  
  67. 2.1.3   Keys
  68.  
  69. A key is a group of letters or other characters derived from one or more of
  70. the data fields in a record and used to identify that record.  The record
  71. number identifies the record in a sense, of course, but record numbers are
  72. of limited use because they only reflect the order in which the records were
  73. entered.  Keys, on the other hand, are derived from the actual data and are
  74. stored in a special table called an index.  The keys in the index are
  75. ordered, either alphabetically or numerically and can therefore be used to
  76. examine the records in an order which is related to the data.  To use an
  77. analogy with books again, you can look up a key in an index and the index
  78. tells Powerbase what “page” it is on, i.e what is the number of the record
  79. to display.
  80.  
  81. A database may have several indices built from keys based on different
  82. fields in the record but there must be at least one which we call the
  83. primary key index. When you come to create a database of your own you will
  84. find that Powerbase insists that you define the primary key before you can
  85. use the database. Subsidiary keys may be defined at any time; whether you
  86. use them or not is up to you. 
  87.  
  88. Look at the key field and at the key itself in the title-bar and you will
  89. see that the two are related. You can recognize the key field on which the
  90.  
  91.                                 - 7 -
  92.  
  93. currently-active key is based by its descriptor (label) which will be red.
  94. Key fields for other keys have blue descriptors. Non-key fields have black
  95. descriptors. The primary key field is further identified by the background
  96. colour of the data rectangle which is pale yellow instead of white like the
  97. other data fields.
  98.  
  99. 2.2     Moving about the database
  100. ---------------------------------
  101. 2.2.1   Browsing
  102.  
  103. Six buttons on the top row of the keypad move you about within the current
  104. subfile. From left to right their actions when clicked on with SELECT are:
  105.  
  106.                                                 Keystroke equivalent
  107.  
  108. (1)     First record                            Ctrl F1            
  109. (2)     Previous record                         F1              
  110. (3)     10 records back − “Fast rewind”         Shift F1              
  111. (4)     10 records forward − “Fast forward”     Shift F2       
  112. (5)     Next record                             F2           
  113. (6)     Final record                            Ctrl F2 
  114.  
  115. The number of records forward or back for actions (3) and (4) is determined
  116. by the number (“Fast forward” interval) in the writable icon between the
  117. associated keypad buttons. The terms first, previous, back, forward, next
  118. and final refer to the order of records as determined by the keys in the
  119. index. The file “wraps around” so after the final record clicking the Next
  120. record button takes you to the first record. If you display the first
  121. record, clicking the Previous record button takes you to the final one. In
  122. accordance with RISC OS conventions clicking with ADJUST instead of SELECT
  123. reverses these actions so that ADJUST over the Next record button, for
  124. instance, takes you to the previous record rather than the next. This allows
  125. you to move about the database with fewer movements of the mouse.
  126.         
  127. The buttons at the start and end of the second keypad row resemble the Play
  128. and Stop buttons of a tape or video recorder and it will be convenient to
  129. refer to them by these names. Play (F11) causes Powerbase to run through the
  130. records, displaying each one briefly, and Stop (Shift F11) halts the
  131. process. Closing the record window has the same effect as Stop.  If Play is
  132. clicked with SELECT records are displayed in forward order.  Using ADJUST
  133. displays them in reverse order. You may swap the order at any time by a
  134. further click on Play. The time for which each record remains on screen may
  135. be altered by changing the “Fast forward” interval (see above); the larger
  136. number you type into this icon the longer each record will remain on screen.  
  137.  
  138. At the bottom of the keypad are four “bookmark” icons which let you mark
  139. specific records for rapid retrieval. Click on one with SELECT  and the
  140. number of the current record appears in the icon.  Clicking with SELECT on a
  141. bookmark icon which contains a record number will return you to that record. 
  142. Click with ADJUST to clear the marker.
  143.  
  144. 2.2.2   Moving to related records
  145.  
  146. If you Shift/double-click on a field with SELECT, and the contents of the
  147. field match the current key of another record, that record will be
  148. displayed. We call this the lookup function. It will also work if a field
  149. contains a comma separated list of keys. Shift/double-click on any one of
  150. these keys takes you to the relevant record. You could experiment with this
  151. using the Elements database. Look up, say, SODIUM, enter in one of the
  152. ‘Notes’ fields the primary keys of the other Group 1 metals, i.e.
  153. lith,pota,rubi,caes,fran. You can now access the records of these five
  154. elements from SODIUM’s record.      
  155.  
  156. 2.2.3   Changing keys
  157.  
  158. Two buttons in the middle of the second row of the keypad bear a symbol
  159. resembling a key. They enable you to cycle through the available indices in
  160. opposite directions (Shift F4 and Shift F5 respectively). ADJUST, as usual,
  161. reverses the action of SELECT and “wrap around” again applies. If no
  162. subsidiary indices have been defined these buttons will have no effect.
  163.  
  164.                                 - 8 -   
  165.  
  166. 2.2.4   Changing subfiles
  167.  
  168. Three buttons in the centre of the third row of the keypad have the
  169. following effect when clicked with SELECT:
  170.  
  171. (1)     Go to previous subfile  (F4)
  172. (2)     Rotate subfiles         (Ctrl F4)
  173. (3)     Go to next subfile      (F5)
  174.  
  175. (1) and (3) change the current subfile to the previous one in sequence and
  176. the next in sequence respectively. As with the corresponding buttons for
  177. moving from record to record and key to key Next subfile from subfile 5
  178. takes you to subfile 0 and Previous subfile from 0 takes you to 5. ADJUST
  179. reverses these actions. Rotate renumbers the subfiles so that subfile 0
  180. becomes 1, subfile 1 becomes 2 etc.  Subfile 5 becomes 0. Records which were
  181. previously in, for example, subfile 2 will then be found in subfile 3. As
  182. this is quite a drastic change you will be asked to confirm that it’s what
  183. you really want before Powerbase proceeds. 
  184.  
  185. 2.2.5   Using more than one subfile 
  186.  
  187. A Powerbase database consists, as stated earlier, of six subfiles numbered
  188. 0-5. You may use subfile 0 (which is the one used by default) and ignore the
  189. others if you wish, but there are occasions when users might find two or
  190. more subfiles very useful. If, for example, you are maintaining a set of
  191. pupil records in a school you could assign one subfile to each year. At the
  192. end of a school year the promotion of Year 1 pupils to Year 2, Year 2 to
  193. Year 3 etc can be brought about by a single click on the Rotate button. (In
  194. an 11-16 school this would put the leavers into subfile 0, from which they
  195. could later be removed.)
  196.  
  197. A more common use of subfiles is to use subfile 0 to hold the in-use records
  198. and subfile 1 as a dumping ground for records which you want out of the way
  199. but don’t want to lose permanently. Powerbase is actually used in this way
  200. in a Further Education college where the applications file for a course is
  201. built up in subfile 0. On enrolment day records are updated to reflect
  202. students’ subject choices and all the records for applicants who have not
  203. appeared are moved into subfile 1. The enrolled students in subfile 0 are
  204. then timetabled and class lists are printed. During the first week of the
  205. course there is a trickle of late enrolments which simply involve retrieving
  206. the required records from subfile 1 and reinstating them in subfile 0. 
  207.  
  208. The facilities for moving records, singly or in batches, from one subfile to
  209. another are described in 2.4.2 and 2.5.6. You can, of course, also select a
  210. subfile and type new records directly into it.
  211.  
  212. 2.2.6   Naming subfiles
  213.  
  214. To give subfiles meaningful names click MENU over the record window and go
  215. to the Miscellaneous submenu.  From there Name subfile leads to a writable
  216. menu item into which you may type a name of up to 20 characters. This then
  217. becomes the name of the current subfile and will be saved on closing the
  218. database.
  219.  
  220. 2.3     Searching for a record
  221. ------------------------------
  222. It’s all very well being able to move about the database like flipping
  223. through the pages of a book but how do we find a specific record?  Powerbase
  224. provides three ways of doing this: you can search for the record by key, by
  225. record number or by using a filter.
  226.  
  227. 2.3.1   Searching by key
  228.  
  229. The icon bearing a record card and a question mark is the Search button
  230. (F8). When clicked with SELECT  the Search window opens to the right of the
  231. keypad. Type the key of the required record into the writable icon and click
  232. on the Find button or type Return. To see how the key is constructed from
  233. the key field click MENU over the record window and choose Index => Show
  234. details (Ctrl K). This displays a window describing the key structure of the
  235. currently-active index.
  236.  
  237. If the key exists in the index the record will be found and displayed. If
  238. the key doesn’t exist Powerbase beeps and displays the nearest matching
  239. record with the key field flashing. If the database is a small one with keys
  240. which differ greatly from record to record then the displayed record may not
  241. look to be very near at all.  If you typed Return or used SELECT on the Find
  242. button the Search window will be closed. If you want to search repeatedly it
  243. is more convenient to have the window stay on screen and this can be
  244. achieved by clicking on Find with ADJUST. If you do this you will notice
  245. that the icon above the Find button displays the number of matches found.
  246.  
  247. Clicking on the “bump” icons (the up and down arrowheads) in the Search
  248. window allows you to search an index other than the current one. The index
  249.  
  250.                                 - 9 -   
  251.  
  252. used affects the search only; clicking the “browse” buttons on the keypad
  253. will show you that the current index has not been changed.
  254.  
  255. A search carried out as described looks only at the current subfile. If you
  256. suspect that the record you require might be lurking in some other subfile
  257. you can force all six to be searched. This can be achieved by using ADJUST
  258. (Shift F8) instead of SELECT on the keypad Search button. When the Search
  259. window appears you will see that the All subfiles radio button is selected
  260. instead of This subfile. The radio buttons enable you to change your mind
  261. after the window has been opened.
  262.  
  263. If searching on a numeric key you must enter a number of exactly the right
  264. value. If, however, the key is alphabetic you may use just the first few
  265. letters if they are sufficient to distinguish the key from others.
  266.  
  267. There are two other buttons on the Search window. Old restores the last key
  268. entered into the writable icon and Cancel simply removes the window from the
  269. screen without further action.
  270.  
  271. 2.3.2   Searching by record number  
  272.  
  273. You may type a record number, preceded by # (e.g. #1054), in the Search
  274. window instead of a key. Provided the record is in use Powerbase will find
  275. and display it, regardless of which subfile it is in. Bear in mind that, if
  276. the record is found in some other subfile than the current one, that subfile
  277. will become the current one. If the record has been deleted or has never
  278. been assigned a “Record #xxx is not in use” message is displayed. 
  279.  
  280. 2.3.3   Searching by filter
  281.  
  282. The Filter switch (Ctrl F8) is in the middle of the last row on the keypad.
  283. Selecting it brings up the Filter window which contains a writable icon into
  284. which you can type a search formula (see 3.4).  You should then click on the
  285. Filter button in the Filter window or, alternatively, type Return. The
  286. keypad buttons used for browsing will now only display records which match
  287. the search formula, all non-matching records being filtered out. Deselecting
  288. the Filter switch closes the Filter window and restores normal keypad
  289. operation.  So does clicking Cancel on the Filter window. The Close button
  290. simply closes the Filter window but leaves the filter in effect − useful if
  291. you want the window out of the way once you’ve set up a filter.
  292.  
  293. 2.4     Editing the database − fundamental operations
  294. -----------------------------------------------------
  295. 2.4.1   Adding new records
  296.  
  297. The icon bearing a record card and a plus sign is the Add record button
  298. (F10). Clicking with SELECT displays a blank record for you to fill in. The
  299. subfile number and anticipated record number are shown in the title-bar of
  300. the record window but there is, of course, no key as yet because there is no
  301. data. The title-bar therefore reads “(New)” in the place where the key
  302. normally appears.  In most databases you may leave blank any fields except
  303. the primary key field.† Powerbase does, however, allow other fields to be
  304. defined as mandatory fields. If the database contains such fields (which
  305. normally have red as their foreground colour) you will be told about them
  306. when you try to move to another record or close the database and will be
  307. unable to do so until you fill them in. You might also find that on some
  308. fields pressing certain keys has no effect. This will happen, for example,
  309. if you try to type letters into a field which has been defined as Numeric.
  310.  
  311. If you type into a field whose text and border are dark green you may get an
  312. error message. These fields only accept certain values which are listed in a
  313. validation table (see 5.2). To see what these values are make sure the caret
  314. is in the relevant field then click on the List values button on the
  315. keypad.
  316.  
  317. After entering data into a field you can go to the next field in sequence by
  318. typing either the Return or the down-arrow key⇩. To go back one field use
  319. the up-arrow key⇧. These arrow keys work in such a way that attempting to go
  320. beyond the last field of the record takes you to the first field and
  321. attempting to go back from the first field takes you to the last. Typing
  322. Return on the last field of a record acts rather differently in that it
  323. writes the record to disc and brings up a new blank record for editing, i.e.
  324. it duplicates the action of the Add record button on the keypad. You can, in
  325. addition, place the caret in any editable field by clicking with SELECT.
  326.  
  327. When you have entered as much of a record as you wish you can click Add
  328. record again for another blank record. The record you have just entered is
  329. automatically written to the database. The same is true if you click on any
  330.  
  331.                                 - 10 -   
  332.  
  333. other keypad button or close the database altogether. You don’t need to use
  334. the Force update (F3) button to tell Powerbase to write the record.  The
  335. real purpose of this button is to make Powerbase save indices and validation
  336. tables which are stored in memory. Occasional use of the button during a
  337. long working session guards against power cuts or system failure.
  338.  
  339. 2.4.2   Deleting records
  340.  
  341. The fourth row of the keypad has only three buttons, the middle one of which
  342. suggests putting an index card in a dustbin.  This is obviously the Delete
  343. button (Ctrl F10) but what are the others? The left button (F6) moves the
  344. displayed record back one subfile, i.e. if the record is in subfile 1 it
  345. will be moved to subfile 0.  If it is in subfile 0 it will be moved into
  346. subfile 5 (“wrap-around” again).  The right button (F7) moves the record
  347. forward one subfile. A record in subfile 5 will be moved into subfile 0. 
  348. These buttons, which we will refer to as Shift back and Shift forward
  349. respectively, clearly don’t delete records at all, except in the sense
  350. “delete from the current subfile”. We often want to get a record out of our
  351. way but keep open the option of bringing it back again and that’s where
  352. these buttons are really useful. If you have a lot of records in subfile 0
  353. and want to do a clear-out you can use subfile 1 as a dumping-ground for the
  354. unwanted records. You’re not really deleting them: just removing them from
  355. the subfile you’re working in.  
  356.  
  357. It is sometimes useful when shifting a record, to be able to “follow” it
  358. into its new subfile. You can do so by holding down SHIFT while you click on
  359. the Shift forward or Shift back button. 
  360.  
  361. The Delete (dustbin) button should only be used when you are sure you want
  362. to lose the record permanently.  As this is quite a drastic action Powerbase
  363. will ask you to confirm it before the record actually disappears. Nervous
  364. users may prefer to leave this button strictly alone and do all their
  365. “deleting” with Shift forward.  If this eventually results in a lot of
  366. clutter in the subfile next to the one you’re using you can always do an
  367. occasional clear-out as described in 2.5.7.
  368.  
  369. 2.4.3   Altering existing records
  370.  
  371. A displayed record may be altered manually without any restrictions other
  372. than those applying to the addition of new records (see 2.4.1). Alterations
  373. which would result in a change to the primary key must be confirmed. Normal
  374. RISC OS conventions for editing writable icons apply, e.g. Ctrl U clears the
  375. icon. As with new record entries you need do nothing to save your changes to
  376. disc. The process takes place automatically before a different record is
  377. displayed, when a database is closed or on quitting Powerbase. 
  378.  
  379. 2.4.4   Undoing mistakes        
  380.  
  381. Changes to the record on-screen can be undone provided you haven’t clicked
  382. on Force update (not normally needed anyway) or done anything to cause
  383. Powerbase to display a different record. In other words, you can undo
  384. changes made to the current record as long as it remains on the screen. You
  385. may either undo all the alterations made to the record or only those
  386. relating to specific fields.
  387.  
  388. If you bring up the main menu and choose Undo changes the record will be
  389. returned to the state it was in when you displayed it and before you began
  390. to edit it. To restore an individual field, click MENU over the field then
  391. go to the Field submenu and choose Undo changes from there. Only ordinary
  392. writable fields and check boxes may be restored; you can’t restore External
  393. fields (see 2.6) which is why a warning is normally issued before deleting
  394. such fields.
  395.  
  396. 2.5     Editing the database − special features
  397. -----------------------------------------------
  398. Section 2.4 described all the editing facilities you actually need in order
  399. to maintain your database. The features described in this section are not
  400. essential but they can save you time and make your use of the database more
  401. efficient.
  402.  
  403. 2.5.1   Using a template 
  404.  
  405. You may want certain fields to be filled in with fixed contents on every new
  406. record to save typing the same thing every time and Powerbase provides a
  407. means of doing this. Call up the main menu, go to the Miscellaneous submenu
  408. and choose Edit template. A blank record is displayed and the window title
  409. says “Enter data which you wish to appear by default on new records”. Type
  410. in the required fixed data then click any of the usual keypad buttons. You
  411. will now find that the new record displayed every time you click Add record
  412. is no longer blank but already contains the data entered in your template.
  413. This feature affects new records only; it doesn’t have a retrospective
  414. effect on existing records.
  415.  
  416.                                 - 11 -
  417.  
  418. 2.5.2   Copying fields
  419.  
  420. The buttons at the far left and right of the third row of the keypad may be
  421. thought of as Copy to Clipboard (Ctrl C) and Paste from Clipboard (Ctrl V)
  422. respectively. They can save a lot of time when you want to copy data from
  423. one field into another. When you click SELECT on Copy, the contents of the
  424. field which owns the caret is stored in memory. Positioning the caret in
  425. another field and clicking on Paste will copy the stored data into the new
  426. field, erasing the field’s previous contents (if any). If the data is too
  427. long for the field it will be truncated. If there is nothing on the
  428. clipboard the corresponding data from the previously-displayed record will
  429. be copied to the field. Copy and Paste are not limited to copying into
  430. another field of the same record; you may use them to copy data between
  431. records or from a record into a validation table or a dialogue box or,
  432. indeed, between any two writable icons within Powerbase. Data remains on the
  433. clipboard until you use Copy again.
  434.  
  435. If you  have highlighted fields using ADJUST as if for printing (see 3.3)
  436. clicking SELECT on the Add record button displays the new record with all
  437. the highlighted data from the previously-displayed record already entered. 
  438. To prevent the accidental creation of unwanted records primary key fields
  439. are not copied in this way.  (Remember that a record will not be added to
  440. the database if the primary key field is blank.)
  441.  
  442. This is a suitable place to explain how Powerbase can also copy data to and
  443. from other applications by means of the global clipboard. The latter is a
  444. feature of RISC OS which few users seem to know about and not all
  445. applications use it. Here’s how it works. Highlight one or more fields with
  446. ADJUST as described above and make sure the caret is in the displayed
  447. record. It needn’t be in one of the highlighted fields; any field will do.
  448. Now type Ctrl Shift C. Nothing appears to have happened but the highlighted
  449. data is now on the global clipboard. If you open, say, an Impression window,
  450. place the caret in it and type Ctrl V the data will be copied to Impression.     
  451.  
  452. If, on the other hand, you highlight data in Impression and type Ctrl C,
  453. then place the caret in a Powerbase record and type Ctrl Shift V the data
  454. will be copied from Impression to Powerbase. The same method may be used to
  455. copy data from Powerbase to Writer, Easywriter or Techwriter.  For StrongEd
  456. you need to type Ctrl Shift V. Although copying in the reverse direction
  457. works fine with Impression it does not appear to work with these other
  458. applications. Edit doesn’t appear to support the global clipboard at all.
  459.  
  460. 2.5.3   Copying an entire record
  461.  
  462. When a new record contains much of the same information as an existing one
  463. you can save time by copying a whole record and editing the copy. Display
  464. the record you want to copy and then click the Add record button with ADJUST
  465. instead of SELECT (Shift F10).  No blank record appears when you do this;
  466. instead an exact copy of the current record is displayed and a message
  467. appears informing you of this.  If you make no changes to the copy Powerbase
  468. will not add the new record to the database.  (It is assumed that no-one
  469. will ever want two absolutely identical records in the same database!)  Any
  470. alteration, however, leads to the record becoming part of the database.
  471.  
  472. 2.5.4   Choosing the field where editing starts
  473.  
  474. When an existing or blank record is displayed Powerbase places the caret in
  475. the first (i.e. lowest-numbered) writable field of the record. This might
  476. not necessarily look like the first if the fields have been placed in
  477. out-of-sequence positions in the window. When going through a database
  478. making changes to one or two fields somewhere in the middle of records it
  479. might be convenient to have the caret start somewhere else. Click MENU over
  480. the field where you wish the caret to start, go to the Field submenu and
  481. choose Start editing. Whenever a record is displayed the caret will be
  482. placed in the chosen field. The same procedure is used to restore the normal
  483. starting position. 
  484.  
  485. 2.5.5   Changing many records at once
  486.  
  487. To alter a given field in a set of records point the mouse at the field and
  488. click MENU. Go to the Field submenu and choose Global changes. In the first
  489. writable icon (Replace) enter what you want changing and in the second
  490. (with) enter what you want the field changing to. In the third you may enter
  491. a search formula (see 3.4) specifying which records are to be changed.
  492. Finally click on Change or type Return.  Note the following:
  493.  
  494. •       Only records in the current subfile are affected.
  495.  
  496. •       Replacement only occurs if the new data will fit in the field.
  497.  
  498.                                 - 12 -
  499.  
  500. •       Leaving Replace blank causes the target field to be replaced in any
  501.         record which matches the search formula, otherwise replacement
  502.         occurs only where the existing field matches the Replace string.
  503.  
  504. •       Leaving with blank causes the target field to be blanked in records
  505.         which match the search formula and in which the target field matches
  506.         the Replace string.
  507.  
  508. •       Leaving the search formula blank causes replacement to occur in all
  509.         records of the current subfile for which the target field matches
  510.         the Replace string.
  511.  
  512. It should be apparent from the above that leaving both Replace and the
  513. Search formula blank will place the with string in all records of the
  514. current subfile. Since this is a rather drastic facility you will be asked
  515. for confirmation before the changes go ahead.
  516.  
  517. The characters “$” and “#” may be used as “wild-card” characters in the
  518. Replace and with strings.* The first of these is used to represent a group
  519. of characters which don’t need to be matched.  If you enter:
  520.  
  521.         Replace $Street with $Road
  522.  
  523. the substitution will be performed on any record which matches the search
  524. formula and where the target field ends with “Street”. The ending will be
  525. changed to “Road” leaving the rest of the string unchanged.  Another example
  526. of use is: 
  527.  
  528.         Replace 47$ with 1047$
  529.  
  530. If the target field begins with “47”, the beginning will be changed to
  531. “1047”, the remainder left unaltered.    
  532.  
  533.         Replace $MPUT$ with $NFUS$
  534.  
  535. would change “MPUT” occurring anywhere in the target field into “NFUS”, e.g.
  536. “COMPUTER” would become “CONFUSER”(!).  You may, of course, use “$” in the
  537. middle of a word:
  538.  
  539.         Replace re$ment with dis$d
  540.  
  541. would cause a string in the target field beginning with “re” and ending with
  542. “ment” to have its head and tail replaced with “dis” and “ed”, leaving the
  543. middle unchanged. e.g. “replacement” would become “displaced”. 
  544.  
  545. The “#” character is used to represent a single wild-card character and can
  546. replace individual letters in specific positions. The Replace and with
  547. strings must be the same length and should have “#” characters in the same
  548. positions. The characters in the remaining positions are the ones which get
  549. replaced, but only if they occur in the corresponding positions of the
  550. existing field value. 
  551.  
  552. You may also use Global changes to perform  simple calculations e.g. “+12”
  553. in with will add 12 to the current value in the field on all the matching
  554. records. “*5-13” will multiply the current value by 5 and then subtract 13.
  555. It is operations like these which are most likely to produce values which
  556. won’t fit in the field, especially if floating-point numbers are involved.
  557. The operation isn’t limited to Numeric fields, or even to other types of
  558. field consisting wholly of numerals; Powerbase will find the number embedded
  559. in an entry such as “ABC45XYZ” and the operation “+12” would convert it to
  560. “ABC57XYZ”.
  561.  
  562. 2.5.6   Moving or deleting many records at once
  563.  
  564. Choose Move/delete from the Miscellaneous submenu. This opens a window which
  565. gives you the choice of three types of operation:
  566.  
  567. (a)     Delete records from a designated subfile
  568. (b)     Accumulate records from all subfiles into one designated subfile
  569. (c)     Move records from one designated subfile to another
  570.  
  571. The default is to Move records from the current subfile to the next in
  572. sequence, but any source or destination subfile may be specified by clicking
  573. on the bump-icons. Type in a search formula (see 3.4) and click the default
  574. action button or type Return. All matching records will be moved or deleted
  575. as specified. Operations  by clicking on the Undo button, but only for the
  576. last operation carried out. 
  577.  
  578. 2.5.7   Hiding sensitive data
  579.  
  580. Your database might contain information which you don’t want just anyone to
  581. read. A field may be hidden by placing the caret in it and typing Ctrl Shift
  582. F9.  The text changes from black to mid-grey to tell you that something has
  583. been done to it.   If you subsequently type Ctrl Shift F2 all such fields
  584. will vanish. You can make them reappear (in mid grey) with Ctrl Shift F1 but
  585.  
  586.                                 - 13 -
  587.  
  588. they will always be invisible when the database is first opened. Ctrl Shift
  589. F9 has a toggle action: repeating the operation on a field removes the
  590. protection.
  591.  
  592. Whilst in the invisible state a field cannot be selected for printing (see
  593. 3.3). ADJUST has no effect and you can’t sneak round the protection by using
  594. Ctrl A to select all fields or by choosing a range containing the hidden
  595. field (i.e. by clicking with SELECT on an earlier field then double-clicking
  596. with ADJUST on a later one).  Its tag doesn’t appear in the Field entry of
  597. the main menu when you click MENU in the relevant place, nor does the field
  598. appear in the field list produced by typing Ctrl F. As soon as you reveal
  599. the data by typing Ctrl Shift F1 it can be printed as normal.
  600.  
  601. If you intend to use this facility you are strongly urged to password-
  602. protect your database (see Ch 11).  Only a user with Manager access rights
  603. will then be able to use Ctrl Shift F1, F2 and F9.  If you leave the
  604. database unprotected then anyone can use the key combinations and might
  605. easily discover  them by chance (or by reading this manual!).
  606.  
  607. 2.6     External fields
  608. -----------------------
  609. The data in External fields is not stored within the Database file but in
  610. separate files, one for each record. With the exception of Remote fields
  611. these files are stored inside the database’s application directory.  They
  612. may be Text, Sprite or Draw files and can be linked to buttons on the record
  613. window. Clicking on these buttons loads the External file into Edit, Paint
  614. or Draw provided that the relevant program has been “seen” by the filer.
  615. (For Remote fields the file objects can be of any type whatsoever including
  616. applications and directories and clicking on the button performs the
  617. appropriate action, e.g. an application is run, a directory is opened, an
  618. Obey or Basic file is executed, other files are loaded into the appropriate
  619. editor if the filer knows where it is.  Remote fields are discussed fully in
  620. Ch 4.)
  621.  
  622. It is also possible to link Text files to a Text block field which will
  623. actually display the text (with certain limitations) within a large icon.
  624. Sprites may be similarly displayed in a Picture field.
  625.  
  626. 2.6.1   Linking files to the fields
  627.  
  628. To link a file with an External field drag the file’s icon onto the record
  629. window and drop it on the appropriate field. For example, if the record
  630. includes a field represented by a Text button, i.e. one bearing a small
  631. version of the Edit icon, you may drop a Text file onto it. The button’s
  632. icon changes to the small version of the Text file icon to indicate that the
  633. file has been linked. Sprite and Draw files are linked in the same way and
  634. Powerbase will not allow the wrong type of file to be linked. A Text block
  635. field also may have a Text file dropped onto it.* The text (or as much of it
  636. as will fit inside the icon) is then displayed on the record window.  The
  637. formatting will not be the same as it is when you examine the text in Edit;
  638. lines are word-wrapped and centred within the display icon. (This is a
  639. feature of multi-line RISC OS text icons and is out of the control of
  640. Powerbase.) You can’t edit the text directly but it is possible to export
  641. the file for editing (see below). Sprite files may be dropped onto and
  642. displayed in a Picture field. Any new file dropped onto an External field
  643. which is already linked to a file simply replaces the old file with the new. 
  644.  
  645. 2.6.2   Editing External fields
  646.  
  647. You can’t edit an External field directly, only via an appropriate editing
  648. program such as Edit, Paint or Draw. As long as the editor has been “seen”
  649. by the filer clicking on the on-screen button with SELECT will load the file
  650. into the editor and display it. You can edit the file and re-save it without
  651. altering its name and it will remain associated with the same field of the
  652. record.  Text block and Picture files are loaded into their editors by a
  653. double click.
  654.  
  655. 2.6.3   Clearing and exporting field contents
  656.  
  657. Clicking MENU over an External field makes available certain entries on the
  658. Field submenu which are shaded for other types of field. Remove external
  659. lets you delete the linked file from the database application.† As deleting
  660. a file is rather drastic you would probably like to be warned when this is
  661. about to happen so the message “Delete object? Are you sure?” normally
  662. appears. Finally, Save contents on the Field submenu lets you export the
  663. linked field to a filer window or to another application.
  664.  
  665.                                 - 14 - 
  666.  
  667. 2.6.4   Editing scrollable lists
  668.  
  669. Entering or altering data in a scrollable list is not very different from
  670. doing so in other types of field, but some keys do behave differently and
  671. there are extra keystrokes to access the special features of such lists.
  672.  
  673. Return moves the caret from cell to cell across the current row, then jumps
  674. to the start of the next row. When it reaches the last visible cell the list
  675. will scroll up a row if there are still rows to display. If the last cell of
  676. the list has been reached the caret moves to the next field or next record,
  677. just as it does for other types of editable field.
  678.  
  679. Shift-Return behaves like Return until the last cell of the list is reached.
  680. It then adds a row to the list, moving the caret to the start of the new
  681. row. You may add as many rows as you wish and each record can have a
  682. different number of rows.
  683.  
  684. Insert with the caret anywhere in the list also adds a row to the end, but
  685. this time without scrolling the list or moving the caret. There is (at
  686. present) no way of inserting a blank row into the middle of the list.
  687.  
  688. Shift-Insert is used to remove unwanted blank rows. (Not Shift-Delete, as
  689. you might expect because this will have the same effect on characters as
  690. Delete!) This key-combination is quite safe: it will only delete when the
  691. caret is in the last row and only if that row is blank.
  692.  
  693. Ctrl-Shift-Insert will force the deletion of whatever row the caret is in.
  694. You aren’t very likely to use this accidentally.
  695.  
  696. Neither Shift-Insert nor Ctrl-Shift-Insert will let you delete rows so that
  697. the number is fewer than the window can display: when the scroll-bar
  698. completely fills its slot this minimum has been reached.
  699.  
  700. Up and Down arrows move the caret vertically from cell to cell, staying in
  701. the same column. When at the top or bottom of the list wrap-around occurs
  702. instead of the caret moving to the previous or following field as it does
  703. for other field types.
  704.  
  705. Wiping a scrollable list
  706. ------------------------
  707. Click MENU over the list and go to the Field submenu. Choose Blank list. You
  708. will be asked for confirmation before the data is deleted.
  709.  
  710. Data export and import
  711. ----------------------
  712. When MENU is clicked over a scrollable list two choices become available on
  713. the Field submenu in addition to Blank list noted above:
  714.  
  715. Save as list saves the contents of the scrollable list as a plain text file.
  716. The contents of each cell of the list occupies a separate line and there is
  717. nothing in the file to indicate which items came from the same row and which
  718. came from different rows. If such a list is dropped onto a scrollable list
  719. field the data will be imported cell by cell, working along each row to the
  720. end and then moving to the next.
  721.  
  722. Save as CSV saves the list as a CSV file (see Ch 8) with each row of the
  723. list as a separate CSV record and each cell in the row as a CSV field. The
  724. characteristics of the file are determined by the CSV Options window just as
  725. they are for exporting data from ordinary fields.
  726.  
  727. If you drop such as CSV file onto a scrollable list field the result is
  728. somewhat different from the importing of a text list as described above
  729. because the data in the file is more structured; the row and column
  730. information of the field from which the data came has been retained. 
  731.  
  732. Suppose you have exported such a file from a 3-column scrollable list. If
  733. you drop the file onto a 2-column list the third item in each line of the
  734. file will be ignored: the destination field will contain what the first two
  735. columns of the source field contained. If, on the other hand, you drop the
  736. file onto a 4-column scrollable list the 4th column of the list will be left
  737. blank.
  738.  
  739.                                 - 15 -       
  740.  
  741.  
  742.  
  743.